#ifndef _PID_H_
#define _PID_H_
#include <stdint.h>

typedef struct {
  float p;
  float i;
  float d;
  struct {
    float k;
    float i_limit;
    float d_out_limit;
    float integral;
    float out_limit;
  } advantage;
} PID_Param_t;

/**
 * @brief PID计算
 *
 * @param pid pid值
 * @param feedback 电机反馈值
 * @param differential 误差微分值
 * @param setpoint 电机预期值
 * @return float
 */
float PID_Apply(PID_Param_t *pid, float feedback, float differential,
                float setpoint);

#endif
